local H = require "packages.ol_hegemony.util"

local firebow = fk.CreateSkill{
    name = "hs__firebow",
    dynamic_desc = function(self, player)
      if H.hasHegLordSkill(Fk:currentRoom(), player, "shouyue") then
        return "hs__firebow_shouyue"
      else
        return "hs__firebow"
      end
    end,
}

firebow:addEffect(fk.TargetSpecified,{
    anim_type = "offensive",
    can_trigger = function(self, event, target, player, data)
        if not (target == player and player:hasSkill(firebow.name)) then return end
        local to = data.to
        return data.card.trueName == "slash" and to.hp >= player.hp
      end,
      on_use = function(self, event, target, player, data)
        local choices = {"firebow-damage","firebow-qiangzhong"}
        local room = player.room
        local choice = room:askToChoice(player,{
            choices = choices,
            skill_name = firebow.name,
            prompt = "#firebow-chosen",
        })
        if choice == "firebow-damage" then
          data.additionalDamage = (data.additionalDamage or 0) + 1
        else
          data.disresponsive = true
        end
      end,
})

firebow:addEffect("atkrange",{--五虎将大旗距离+1
    correct_func = function(self, from, to)
        if from:hasSkill(firebow.name) and from:hasShownSkill(firebow.name) then
          if H.hasHegLordSkill(Fk:currentRoom(), from, "shouyue") then
            return 1
          end
        end
        return 0
      end,
})

firebow:addEffect("targetmod",{
    bypass_distances =  function(self, player, skill, card, target)
        if skill.trueName == "slash_skill" and player:hasSkill(firebow.name) and player.derivative_skills[Fk.skills[firebow.name]] then
          return card and target and target:getHandcardNum() <= player:getHandcardNum()
          end
      end,
})

Fk:loadTranslationTable{
    ["hs__firebow"] = "烈弓",
    [":hs__firebow"] = "你对手牌数小于等于你的角色使用【杀】无距离关系的限制。当你于使用【杀】指定一个目标后，若其体力值大于等于你，你可以选择一项：1.令此【杀】对其造成的伤害+1；2.令其不能使用【闪】响应此【杀】。",
    ["firebow-damage"]="此【杀】的伤害+1",
    ["firebow-qiangzhong"]="此【杀】不可被响应",
    ["#firebow-chosen"]="烈弓：选择一项",
    ["hs__firebow_shouyue"] = "烈弓",
    [":hs__firebow_shouyue"] = "你的攻击范围+1。你对手牌数小于等于你的角色使用【杀】无距离关系的限制。当你于使用【杀】指定一个目标后，若其体力值大于等于你，你可以选择一项：1.令此【杀】对其造成的伤害+1；2.令其不能使用【闪】响应此【杀】。<br>"..
    "<b><font color='#DC143C'>★五虎将大旗★</font>",
    ["hs__firebow_can"] = "可烈弓",

    ["$hs__firebow1"] = "穿杨射柳，百发百中！",
    ["$hs__firebow2"] = "烈弓之下，片甲不存！",
}

return firebow